package edu.rpi.testproject;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;

public class Window1 extends Activity {
	Boolean play_status= true;
	Boolean gps_status= true;
	
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main1);
        
        final ImageButton play_button = (ImageButton)findViewById(R.id.play_status);
    
        play_button.setOnClickListener(new View.OnClickListener() {
        	public void onClick(View view) {
        		if(play_status){
        			play_button.setImageResource(R.drawable.pausebutton);
        			play_status=false;
        		}
        		else{
        			play_button.setImageResource(R.drawable.playbutton);
        			play_status=true;
        		}
        	}      
        });
        

        final ImageButton gps_button = (ImageButton)findViewById(R.id.gps_status);
        
        gps_button.setOnClickListener(new View.OnClickListener() {
        	public void onClick(View view) {
        		//final TextView bottom= (TextView) findViewById(R.string.bottom);
        		//bottom.setText(play_button.getId());
        		if(gps_status){
        			gps_button.setImageResource(R.drawable.gps2);
        			gps_status=false;
        		}
        		else{
        			gps_button.setImageResource(R.drawable.gps);
        			gps_status=true;
        		}
        		//setResult(RESULT_OK);
        		//finish();
        	}      
        });
    }
    
	 // Called only the first time the options menu is displayed.
	 // Create the menu entries.
	 // Menu adds items in the order shown.
    @Override
	 public boolean onCreateOptionsMenu(Menu menu) {
	     super.onCreateOptionsMenu(menu);
	     
	     // Parameters for menu.add are:
	     // group -- Not used here.
	     // id -- Used only when you want to handle and identify the click yourself.
	     // title
	     menu.add(0, 0, 0, "Favorites");
	     menu.add(0, 1, 0, "View");
	     menu.add(0, 2, 0, "Feed");
	     return true;
	 }

	 // Activity callback that lets your handle the selection in the class.
	 // Return true to indicate that you've got it, false to indicate
	 // that it should be handled by a declared handler object for that
	 // item (handler objects are discouraged for reasons of efficiency).
	 @Override
	 public boolean onOptionsItemSelected(MenuItem item){
	     switch (item.getItemId()) {
	     case 0:
	    	//Intent i = new Intent(Window1.this, Window2.class);
		    //startActivity(i);
	        return true;
	     case 1:
	    	Intent i = new Intent(Window1.this, Window2.class);
	    	startActivity(i);
	    	return true;
	     case 2:
	    	Intent j = new Intent(Window1.this, Window3.class);
	    	startActivity(j);
	    	return true;
	     }
	     return false;
	 }

}
